type vendor_hal_citsensorservice_xiaomi_hwservice, hwservice_manager_type, protected_hwservice;

type vendor_hal_citsensorservice_xiaomi_default, domain;
hal_server_domain(vendor_hal_citsensorservice_xiaomi_default, vendor_hal_citsensorservice_xiaomi)

type vendor_hal_citsensorservice_xiaomi_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(vendor_hal_citsensorservice_xiaomi_default)

add_hwservice(vendor_hal_citsensorservice_xiaomi_server, vendor_hal_citsensorservice_xiaomi_hwservice)

allow vendor_hal_citsensorservice_xiaomi_client vendor_hal_citsensorservice_xiaomi_hwservice:hwservice_manager find;

binder_call(vendor_hal_citsensorservice_xiaomi_client, vendor_hal_citsensorservice_xiaomi_server)
binder_call(vendor_hal_citsensorservice_xiaomi_server, vendor_hal_citsensorservice_xiaomi_client)

vndbinder_use(vendor_hal_citsensorservice_xiaomi_default)

allow vendor_hal_citsensorservice_xiaomi self:{ socket qipcrtr_socket } create_socket_perms;
allowxperm vendor_hal_citsensorservice_xiaomi self:{ socket qipcrtr_socket } ioctl msm_sock_ipc_ioctls;

allow vendor_hal_citsensorservice_xiaomi_default fwk_sensor_hwservice:hwservice_manager find;

r_dir_file(vendor_hal_citsensorservice_xiaomi_default, vendor_sysfs_graphics)

allow vendor_hal_citsensorservice_xiaomi_default input_device:dir r_dir_perms;
allow vendor_hal_citsensorservice_xiaomi_default input_device:chr_file rw_file_perms;
allow vendor_hal_citsensorservice_xiaomi_default graphics_device:chr_file rw_file_perms;

get_prop(vendor_hal_citsensorservice_xiaomi_default, vendor_sensors_prop)

hal_client_domain(vendor_hal_citsensorservice_xiaomi_default, hal_graphics_allocator)

allow vendor_hal_citsensorservice_xiaomi_default vendor_hal_display_config_hwservice:hwservice_manager find;
allow vendor_hal_citsensorservice_xiaomi_default vendor_qdisplay_service:service_manager find;

binder_call(vendor_hal_citsensorservice_xiaomi_default, hal_graphics_composer_default)
binder_call(vendor_hal_citsensorservice_xiaomi_default, system_server)

r_dir_file(vendor_hal_citsensorservice_xiaomi_default, mnt_vendor_file)

allow vendor_hal_citsensorservice_xiaomi_default vendor_persist_sensors_file:dir create_dir_perms;
allow vendor_hal_citsensorservice_xiaomi_default vendor_persist_sensors_file:file create_file_perms;

#set_prop(vendor_hal_citsensorservice_xiaomi_default, vendor_cct_prop)
vndbinder_use(vendor_hal_citsensorservice_xiaomi)
allow vendor_hal_citsensorservice_xiaomi_client vendor_hal_citsensorservice_xiaomi_server:binder { call transfer };
allow vendor_hal_citsensorservice_xiaomi_client vendor_hal_citsensorservice_xiaomi_server:binder transfer;
allow vendor_hal_citsensorservice_xiaomi_client vendor_hal_citsensorservice_xiaomi_server:fd *;
allow vendor_hal_citsensorservice_xiaomi_server vendor_hal_citsensorservice_xiaomi_client:binder transfer;
allow vendor_hal_citsensorservice_xiaomi_server vendor_hal_citsensorservice_xiaomi_client:binder { call transfer };
allow vendor_hal_citsensorservice_xiaomi_server vendor_hal_citsensorservice_xiaomi_client:fd *;
allow vendor_hal_citsensorservice_xiaomi_default input_device:dir rw_dir_perms;
allow vendor_hal_citsensorservice_xiaomi_default vendor_sysfs_data:file r_file_perms;
allow vendor_hal_citsensorservice_xiaomi_default self:socket create_socket_perms;
allow vendor_hal_citsensorservice_xiaomi_default self:qipcrtr_socket create_socket_perms;
allow vendor_hal_citsensorservice_xiaomi_default vendor_sysfs_graphics:dir r_dir_perms;
allow vendor_hal_citsensorservice_xiaomi_default vendor_sysfs_graphics:file r_file_perms;
allow vendor_hal_citsensorservice_xiaomi_default system_server:binder call;
allow vendor_hal_citsensorservice_xiaomi_default system_server:binder transfer;
allow vendor_hal_citsensorservice_xiaomi_default vendor_sysfs_displayfeature:dir search;
allow vendor_hal_citsensorservice_xiaomi_default vendor_sysfs_displayfeature:file { open read getattr };
allow vendor_hal_citsensorservice_xiaomi_default vendor_displayfeature_prop:file read;
allow vendor_hal_citsensorservice_xiaomi_default vendor_displayfeature_device:chr_file { ioctl open read write };
allow vendor_hal_citsensorservice_xiaomi_default hal_graphics_mapper_hwservice:hwservice_manager find;
allow vendor_hal_citsensorservice_xiaomi_default vendor_hal_display_config_hwservice:binder { call transfer };
allow vendor_hal_citsensorservice_xiaomi_default vendor_hal_display_config_hwservice:fd *;
allow vendor_hal_citsensorservice_xiaomi_default hal_graphics_composer:binder { call transfer };
allow vendor_hal_citsensorservice_xiaomi_default hal_graphics_composer:fd *;
allow vendor_hal_citsensorservice_xiaomi_default hal_graphics_composer_default:binder transfer;
allow vendor_hal_citsensorservice_xiaomi_default vendor_hal_sensorcommunicate_default:binder call;
allow vendor_hal_citsensorservice_xiaomi_default vendor_hal_sensorcommunicate_default:binder transfer;
allowxperm vendor_hal_citsensorservice_xiaomi_default self:socket ioctl { 0xc300 0xc301 0xc302 0xc303 0xc304 0xc305 };
allowxperm vendor_hal_citsensorservice_xiaomi_default self:qipcrtr_socket ioctl { 0xc300 0xc301 0xc302 0xc303 0xc304 0xc305 };

userdebug_or_eng(`get_prop(vendor_hal_citsensorservice_xiaomi_default, vendor_sensors_debug_prop)');
wakelock_use(vendor_hal_citsensorservice_xiaomi_default)

r_dir_file(vendor_hal_citsensorservice_xiaomi_default, vendor_persist_sensors_file)

get_prop(vendor_hal_citsensorservice_xiaomi_default, vendor_displayfeature_prop)
